package chapter_10;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UDPSend {
    public static void main(String[] args) throws IOException {
        DatagramSocket sendSocket = new DatagramSocket();
        byte[] buffer = "hello,UDP".getBytes();

        DatagramPacket dp = new DatagramPacket(buffer, buffer.length,
                InetAddress.getByName("127.0.0.1"), 12306);

        sendSocket.send(dp);
        sendSocket.close();
    }
}
